﻿@using LoginSdk.Utils
@inject LayoutDataServices data

@{
    var session = Context.Session;
    var u = session.getValue<WqUser>("LoginUser");
    var topContent = data.getAdContent().FirstOrDefault(x => x.position == AD_Postion.Top);
}

@*头部登录部分*@
<div style="width:100%;background-color:#F3E9DE;margin-bottom:10px;">
    <div style="width:1200px;" class="row center-block">
        <div class="col-md-8">
            <div class="row">
                <div class="col-md-1 text-left">
                    <span style="cursor:pointer;color:green;" onclick="javascript: location.href='/'">首页</span>
                </div>
                <div class="col-md-11">
                    @{
                        if (topContent != null)
                        {
                            <div>
                                @Html.Raw(topContent.content)
                            </div>
                        }
                        else
                        {
                            <span style="color:#BCAC98;" class="btn-sm">生辰八字算命-周易命理预测 | 阴阳五行八卦研究 | 八字合婚配对查询</span>
                        }
                    }
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="hide row">
                <a id="qqlogin">QQ登录按钮</a>
            </div>
            @{
                if (u != null && u.Id != Guid.Empty)
                {
                    <div class="row" style="font-size:10px;line-height:20px;">
                        @{
                            if (u.IsAdmin)
                            {
                                <div class="col-md-3 text-primary">
                                    <span style="cursor:pointer;" onclick="javascript: window.open('/manage/article/notice','_blank')">后台管理</span>
                                </div>
                            }
                            else
                            {
                                <div class="col-md-3"></div>
                            }
                        }
                        <div class="col-md-9 text-muted text-right">
                            <div class="row">
                                <div class="col-md-8" title="修改自己显示的昵称">
                                    <span style="cursor:pointer;" onclick="javascript: window.open('@Url.Action("setting","account")','_self')">您好,@(u.NickName)</span>
                                </div>
                                <div class="col-md-4">
                                    <span class="logout_user" style="cursor:pointer;">注销登录</span>
                                </div>
                            </div>
                        </div>
                    </div>
                }
                else
                {
                    var ali_state = Guid.NewGuid().ToString();
                    var baidu_state = Guid.NewGuid().ToString();

                    var url = Context.Request.GetCurrentDomain();
                    var ali_login_url = AliLoginUtils.GetLoginUrl($"{url}/AliLoginCallback", ali_state);
                    var baidu_login_url = BaiduLoginUtils.GetLoginUrl($"{url}/baiduLoginCallback", baidu_state);
                    var qq_login_url = QQLoginUtils.GetLoginUrl($"{url}/qqlogin");

                    <div class="text-right">
                        <span id="login_btns">
                            <a href='@ali_login_url'><img src="~/images/logo/ali.png" width="20" height="20" title="支付宝账户登录" /></a>
                            <a href="@baidu_login_url"><img src="~/images/logo/baidu.png" width="20" height="20" title="百度账号登录" /></a>
                            <a href="@qq_login_url" title="QQ登录">
                                <img alt="Connect_logo_1.png" src="https://qzonestyle.gtimg.cn/qzone/vas/opensns/res/img/Connect_logo_1.png">
                            </a>
                        </span>
                    </div>
                }
            }
        </div>
    </div>
</div>
